package com.cjl.eater.config;

import com.cjl.eater.interceptor.EaterFirstInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author cjl
 * @version v1.0
 * @description TODO
 * @createTime 2023/2/16 13:55
 */
@Slf4j
@Configuration
public class EaterWebMVCConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new EaterFirstInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/api/eater/login_auth/**")
                .excludePathPatterns("/swagger-resources/**")
                .excludePathPatterns("/doc.html/**");
        log.info("添加EaterFirstInterceptor拦截器到spring容器中。。。");
    }
}
